package com.zqh.synchronizedDemo;

/**
 * volatile 与 synchronize的简单比较
 */
public class T2 implements Runnable{
    private volatile int count = 10;
    public /*synchronized*/ void run(){
        count--;
        System.out.println(Thread.currentThread().getName()+" count="+count);
    }

    public static void main(String[] args) {
        T2 t = new T2();
        for (int i = 0; i<10*3;i++){
            new Thread(t,"Thread"+i).start();
        }
    }
}
